import java.util.*;
import java.util.concurrent.*;

/**
 * BroadcastDrop
 * Allows for messages to be transfered between all server threads, both
 * incoming and outgoing.
 * @author James Varvaro
 */
public class BroadcastDrop {
    // Message sent from producer
    // to consumer.
    private ConcurrentLinkedQueue<String> msgsIn;
    private ConcurrentLinkedQueue<String> msgsOut;
    
    public BroadcastDrop() {
        msgsIn = new ConcurrentLinkedQueue<String>();
        msgsOut = new ConcurrentLinkedQueue<String>();
    }
    
    public String pollIn() {
        return msgsIn.poll();
    }
    
    public String pollOut() {
        return msgsOut.poll();
    }
    
    public String peekIn() {
        return msgsIn.peek();
    }
    
    public String peekOut() {
        return msgsOut.peek();
    }

    public void putIn(String message) {
        msgsIn.add(message);
    }
    
    public void putOut(String message) {
        msgsOut.add(message);
    }
    
    public boolean statusIn() {
        return msgsIn.isEmpty();
    }
    
    public boolean statusOut() {
        return msgsOut.isEmpty();
    }
}
